package com.hyd.application;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import android.app.Activity;
import android.app.Application;
//DOTO需要有一个得到当前播放需要的音乐的地址
public class MyApplication extends Application{
	//播放器的播放状态，0代表暂停，1代表播放
	public static int playstatus = 0;
	//播放器的播放进度
	public static int playprogress;
	//播放到第几首了
	public static int which = 0;
	//是不是第一次打开播放器
	public static boolean isfirst = true;
	//是否循环
	public static boolean isLoop;
	//音乐列表
	public static ArrayList<String> musicList = new ArrayList<String>();
	//利用单列模式来管理所有的Activity
	private List<Activity> activityList = new LinkedList<Activity>();
	private static MyApplication instance;
	
	public MyApplication(){
		
	}
	@Override
	public void onCreate() {
		super.onCreate();
		
		musicList.add("http://abv.cn/music/光辉岁月.mp3");
		musicList.add("http://abv.cn/music/红豆.mp3");
		musicList.add("http://abv.cn/music/千千阙歌.mp3");
	}

	public static MyApplication getInstance(){
		if(instance == null){
			instance = new MyApplication();
		}
		return instance;
	}
	
	public void addActivity(Activity activity){
		activityList.add(activity);
	}
	
	public void exit(){
		for (Activity activity : activityList) {
			activity.finish();
			activityList.remove(activity);
		}
	}
}
